Skip to content

Conversation

@steffen-karlsson
Copy link
Contributor

We at Corti.ai are building kommodity-io as part of our Sovereign Cloud initiative for AI in Health Care: https://www.corti.ai/sovereign-cloud and want to integrate Scaleway as part of our supported provider list: https://github.com/kommodity-io/kommodity/blob/main/pkg/provider/providers.yaml.

Therefore, we need the reconcilers to be available to use outside of the package, like for CAPZ, Talos or others from the official CAPI Provider list.

@steffen-karlsson
Copy link
Contributor Author

steffen-karlsson commented Sep 22, 2025

See example of integration here: kommodity-io/kommodity#69
Currently using our own fork, as created from this PR using replace in go.mod

@Tomy2e
Copy link
Member

Tomy2e commented Sep 22, 2025

Hello, thank you for integrating our provider in your project.

It looks like CI is failing, could you please add these changes to your PR?

  • Add this line in Dockerfile: COPY pkg/ pkg/
  • Add these exclusions in .golangci-lint.yml:
        - linters:
            - dupl
            - lll
          path: pkg/*
    

I will run e2e in #34 as CI secrets are not accessible from forks.

@steffen-karlsson
Copy link
Contributor Author

  • linters:
    - dupl
    - lll
    path: pkg/*

Done :) Thanks for the quick reply

@Tomy2e
Copy link
Member

Tomy2e commented Sep 22, 2025

On second thoughts, moving controllers to pkg/controller is a bit annoying because it "breaks" kubebuilder as it expects controllers to be in internal/controller by default. Also, there may be breaking changes in this package so we don't want other developers to import this package directly.

Would it be OK for you if we create public aliases to export the reconcilers instead? Something like this in pkg/controller/alias.go:

package controller

import "github.com/scaleway/cluster-api-provider-scaleway/internal/controller"

// Following variables provide access to reconcilers implemented in internal/controller.
var (
	NewScalewayClusterReconciler             = controller.NewScalewayClusterReconciler
	NewScalewayMachineReconciler             = controller.NewScalewayMachineReconciler
	NewScalewayManagedClusterReconciler      = controller.NewScalewayManagedClusterReconciler
	NewScalewayManagedControlPlaneReconciler = controller.NewScalewayManagedControlPlaneReconciler
	NewScalewayManagedMachinePoolReconciler  = controller.NewScalewayManagedMachinePoolReconciler
)

The cluster-api project does something similar for their controllers package: https://github.com/kubernetes-sigs/cluster-api/blob/main/controllers/alias.go

@steffen-karlsson
Copy link
Contributor Author

On second thoughts, moving controllers to pkg/controller is a bit annoying because it "breaks" kubebuilder as it expects controllers to be in internal/controller by default. Also, there may be breaking changes in this package so we don't want other developers to import this package directly.

Would it be OK for you if we create public aliases to export the reconcilers instead? Something like this in pkg/controller/alias.go:

package controller

import "github.com/scaleway/cluster-api-provider-scaleway/internal/controller"

// Following variables provide access to reconcilers implemented in internal/controller.
var (
	NewScalewayClusterReconciler             = controller.NewScalewayClusterReconciler
	NewScalewayMachineReconciler             = controller.NewScalewayMachineReconciler
	NewScalewayManagedClusterReconciler      = controller.NewScalewayManagedClusterReconciler
	NewScalewayManagedControlPlaneReconciler = controller.NewScalewayManagedControlPlaneReconciler
	NewScalewayManagedMachinePoolReconciler  = controller.NewScalewayManagedMachinePoolReconciler
)

The cluster-api project does something similar for their controllers package: https://github.com/kubernetes-sigs/cluster-api/blob/main/controllers/alias.go

Just tested it, works as expected, I've updated the PR.

Co-authored-by: Tomy Guichard <[email protected]>
@Tomy2e Tomy2e changed the title feat(controllers): moving controller to exposed pkg, to use scaleway provider as SDK feat(controllers): expose controller constructors to use scaleway provider as SDK Sep 23, 2025
Copy link
Member

@Tomy2e Tomy2e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Will merge after CI passes

@Tomy2e Tomy2e merged commit c8000b0 into scaleway:main Sep 23, 2025
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants